<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增物品')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-goods-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">物品编码：</label>
                <div class="col-sm-8">
                    <input name="goodsId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">物品名：</label>
                <div class="col-sm-8">
                    <input name="goodName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">父节点：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input id="treeId" name="parentId" type="hidden" th:value="${erpGoods?.goodsId}"/>
                        <input class="form-control" type="text" onclick="selectGoodsTree()" id="treeName" readonly="true" th:value="${erpGoods?.goodName}">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">提醒：</label>
                <div class="col-sm-8">
                    <input name="attention" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">项目：</label>
                <div class="col-sm-8">
<!--                    <input name="projectId" class="form-control" type="text" required>-->

                    <select id="projectId"  name="projectId"  class="form-control"  required>
                        <!--                                    <option value="">所有</option>-->
                        <option  th:each="item:${@erpService.selectErpProjectList()}"
                                 th:text="${item.projectName}"
                                 th:value="${item.projectId}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">项目名：</label>
                <div class="col-sm-8">
                    <input name="projectName" id="projectName" class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">图号：</label>
                <div class="col-sm-8">
                    <input name="drawingNo"  class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">    
                <label class="col-sm-3 control-label">总数：</label>
                <div class="col-sm-8">
                    <input name="totalNumber" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">材质：</label>
                <div class="col-sm-8">
                    <input name="goodsMaterial" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">单重：</label>
                <div class="col-sm-8">
                    <input name="itemWeight" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">总重：</label>
                <div class="col-sm-8">
                    <input name="totalWeight" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">单价：</label>
                <div class="col-sm-8">
                    <input name="itemPrice" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">总价：</label>
                <div class="col-sm-8">
                    <input name="totalPrice" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">供货商名称：</label>
                <div class="col-sm-8">
                    <input name="supplierName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">采购数：</label>
                <div class="col-sm-8">
                    <input name="purchasesNum" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">采购数绑定员工：</label>
                <div class="col-sm-8">
                    <input name="purchasesNumMemberId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">质检数：</label>
                <div class="col-sm-8">
                    <input name="inspectionNum" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">质检数绑定员工：</label>
                <div class="col-sm-8">
                    <input name="inspectionNumMemberId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">入库数：</label>
                <div class="col-sm-8">
                    <input name="stockNum" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">入库数绑定员工：</label>
                <div class="col-sm-8">
                    <input name="stockNumMemberId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">出库数：</label>
                <div class="col-sm-8">
                    <input name="outboundNum" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">出库数绑定员工：</label>
                <div class="col-sm-8">
                    <input name="outboundNumMemberId" class="form-control" type="text">
                </div>
            </div>
<!--            <div class="form-group">-->
<!--                <label class="col-sm-3 control-label">多图：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <textarea name="pictureUrl" class="form-control"></textarea>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">图片备注：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="pictureRemark" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">-->
<!--                <label class="col-sm-3 control-label">视频：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <textarea name="videoUrl" class="form-control"></textarea>-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">视频备注：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="videoRemark" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->

            <div class="form-group">
                <label class="col-sm-3 control-label">工艺：</label>
                <div class="col-sm-8">
                    <input name="technology"   class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">加工员：</label>
                <div class="col-sm-8">
                    <input name="processor"   class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">加工时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="processorTime"   class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>

            <div class="form-group">    
                <label class="col-sm-3 control-label">质检员：</label>
                <div class="col-sm-8">
                    <input name="qualityInspectorName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">质检时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="qualityInspectorTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">结果：</label>
                <div class="col-sm-8">
                    <input name="result" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input name="remark" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "erp/goods"
        $("#form-goods-add").validate({
            focusCleanup: true
        });
        $('#projectId').change(() => {
            $('#projectName').val($('#projectId').find("option:selected").text());
        });
        function submitHandler() {
            $("#projectId").trigger("change");

            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-goods-add').serialize());
            }
        }

        $("input[name='qualityInspectorTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='processorTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        /*物品-新增-选择父物品树*/
        function selectGoodsTree() {
            var options = {
                title: '物品选择',
                width: "380",
                url: prefix + "/selectGoodsTree/" + $("#treeId").val(),
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){

            var body = layer.getChildFrame('body', index);
               $("#treeId").val(body.find('#treeId').val());
               $("#treeName").val(body.find('#treeName').val());
               layer.close(index);
        }
    </script>
</body>
</html>